import { ReqPage, ResPage } from "@/api/interface/index";
import { ServiceResult } from "@/core/fetch/handle";
import { HTTP_METHOD } from "@/enums";

export namespace Api {
  export interface IApi {
    id?: number;
    path?: string;
    description?: string;
    method?: HTTP_METHOD;
    apiGroup?: string;

    [prototype: string]: any;
  }

  export interface IApiGroup {
    apiGroup?: string;

    [prototype: string]: any;
  }

  export interface IApiSync {
    newApis: Api.IApi[];
    deleteApis: Api.IApi[];
    ignoreApis: Api.IApi[];
    apiGroups: string[];
  }

  export interface IApiParams extends ReqPage {
    [prototype: string]: any;
  }

  export type TApiListResult = ServiceResult<ResPage<IApi>>;
  export type TApiDetailResult = ServiceResult<IApi>;

  export type TApiGroupResult = ServiceResult<IApiGroup[]>;

  export type TApiSyncResult = ServiceResult<IApiSync>;
}
